package top.lyjwn.ajui.test;

import com.alibaba.fastjson.JSONObject;

import top.lyjwn.ajui.AJUIApplication;
import top.lyjwn.ajui.data.User;
import top.lyjwn.ajui.util.store.LibertyStoreUtil;

public class UserUtil {

    public static User getUser(){
        String userStr = (String)LibertyStoreUtil.get(AJUIApplication.getContext(), "user");
        if (userStr!=null){
            return  JSONObject.parseObject(userStr).toJavaObject(User.class);
        }
        return null;
    }

    public static void setUser(User user){

        LibertyStoreUtil.put(AJUIApplication.getContext(), "user",JSONObject.toJSONString(user));
    }
}
